export default defineNuxtRouteMiddleware(async(to, from) => {
  console.log(to.fullPath); 
  if(to.fullPath!=="/login" ){
    // const loginStore = useLoginStore()
    // const token= await loginStore.getToken()

    //const xtoken = useCookie('X-Token',{default:():string=>''})

    const token=xToken().getXToken();
    if (token==='') {
      console.log("errortoken: "+token); 
      return navigateTo('/login')
    }else{
      console.log("ok:"+token);
    }
  }
})

// const isAuthenticated=(token:String):boolean=>{
//   console.log(token);
//   if(token===''){
//     return false
//   }
//  return true;
// }
